home *** CD-ROM | disk | FTP | other *** search
/ The Netherlands - A Compact World / The Netherlands.iso / chapters / 1.3.3.dxr / scripting_8_wiel om te draaien.ls < prev    next >
Encoding:
Text File  |  2004-06-10  |  1.2 KB  |  59 lines

  1. on mouseDown
  2.   global beginG, draaien_v2
  3.   beginX = the mouseH - sprite(19).locH
  4.   beginY = the mouseV - sprite(19).locV
  5.   if beginX = 0 then
  6.     beginX = 0.10000000000000001
  7.   end if
  8.   beginG = atan(float(beginY) / float(beginX)) / (PI / 180)
  9.   draaien_v2 = 1
  10. end
  11.  
  12. on mouseUp
  13.   global draaien_v2
  14.   draaien_v2 = 0
  15. end
  16.  
  17. on mouseUpOutSide
  18.   global draaien_v2
  19.   draaien_v2 = 0
  20. end
  21.  
  22. on enterFrame
  23.   global draaien_v2, beginG, VorigG, NuG, horizontaal
  24.   if draaien_v2 = 1 then
  25.     VorigG = NuG
  26.     NuX = the mouseH - sprite(19).locH
  27.     NuY = the mouseV - sprite(19).locV
  28.     if NuX = 0 then
  29.       NuX = 0.10000000000000001
  30.     end if
  31.     NuG = atan(float(NuY) / float(NuX)) / (PI / 180)
  32.     ResultaatG = NuG - beginG
  33.     sprite(19).rotation = ResultaatG
  34.     verdraaiingG = NuG - VorigG
  35.     if verdraaiingG < -300 then
  36.       verdraaiingG = verdraaiingG + 360
  37.     end if
  38.     horizontaal = horizontaal + verdraaiingG
  39.     repeat while horizontaal > 260
  40.       if horizontaal > 260 then
  41.         horizontaal = horizontaal - 180
  42.       end if
  43.     end repeat
  44.     repeat while horizontaal < 80
  45.       if horizontaal < 80 then
  46.         horizontaal = horizontaal + 180
  47.       end if
  48.     end repeat
  49.   end if
  50. end
  51.  
  52. on mouseEnter
  53.   cursor(280)
  54. end
  55.  
  56. on mouseLeave
  57.   cursor(-1)
  58. end
  59.